#!/bin/bash

# 获取前一天的日期
date=$(date -d "yesterday" +"%Y%m%d")
echo "Start processing date: $date"

# 定义输入和输出目录
input_dir="/datasets_hdd/customer_downloadwavs/${date}/"
output_dir="${date}"
log_file="/home/zhaosheng/Documents/dlangchain/app/customer_service_evaluation_system_v2/output/log/${date}.log"
# write to log file
start_time=$(date "+%Y-%m-%d %H:%M:%S")
echo ">>>>>>>>>>>>>>>>" >> "$log_file"
echo "> $start_time: Start processing date: $date" >> "$log_file"

# 确保日志文件目录存在
mkdir -p "$(dirname "$log_file")"

# 执行Python脚本并将日志写入指定文件
/opt/anaconda/anaconda3/bin/python main.py --input_dir "$input_dir" --output_dir "$output_dir" >> "$log_file" 2>&1
echo "Finish processing date: $date"
end_time=$(date "+%Y-%m-%d %H:%M:%S")
echo "> $end_time: Finish processing date: $date" >> "$log_file"